<?php 
session_start();
$active = 'hometours';
$set = 'blogsystem';
if($_GET['page']==='add')
$set = 'blogsystem';
if(!isset($_SESSION['username']) || !isset($_SESSION['id']))
{
	header("Location: index.php");
	exit();
}
require("../config.php");
require("../db/opendb.php");
if(isset($_POST['submit'])) {
	$sql = "UPDATE PROPERTIES SET bg_type='{$_POST['bg_type']}', bg_color='{$_POST['bg_color']}' WHERE OID='".$_POST["listing_id"]."'";
	mysql_query($sql);
}
$query = "select bg_type, bg_color from PROPERTIES WHERE OID='".$_REQUEST["listing_id"]."'";
$result = mysql_query($query) or die ("SQL Error".mysql_error());
$row=mysql_fetch_assoc($result);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Realivent.com - Edit User account</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="css/colorpicker.css" type="text/css" />
<link rel="stylesheet" href="css/layout.css" type="text/css" />
<style>
#data_grid {

	border-collapse:collapse;
	border-right:1px solid #B6CDE7;
	border-bottom:1px solid #B6CDE7;

}
#data_grid a {
	color:#003399;

}
#data_grid a:hover {
	color:#000;
	text-decoration:underline;
}

#data_grid tr {
	height:9px;
}

#data_grid tr.row2 {
	background-color:#DCE0D8;
}
#data_grid tr.row2:hover {
	background-color:#FDFDE7;
}
#data_grid tr.row1{
	background-color:#F7F9FB;
}
#data_grid tr.row1:hover {
	background-color:#FDFDE7;
}
#data_grid th {
	border-left:1px solid #B6CDE7;
	border-top:1px solid #B6CDE7;
	padding:5px;
	background-color:#94A187;
	color:#003399;
}

#data_grid tr td {
	border-left:1px solid #B6CDE7;
	border-top:1px solid #B6CDE7;
	padding:5px 5px 5px 5px;
	color:#444445;
}
</style>
</head>
<body>
<center>
<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center">
 <TR><TD><?php include('accounts_top_navigation.php'); ?></TD></TR>
  <tr>
    <td valign="top" style="height:300px;">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td width="150" valign="top" align="left" >
	<div id="menu_column">
		 <?php
		 if(isset($_SESSION['id']) && $row['disp_profile'] != 'No')
		 {
		 	include("accounts_left_navigation.php");
		 }
		 ?>
      </Div>
	  <div style="padding-top:10px; " align="center">
	   <!--<a href=get_button.php id=banner><img border="0" src=../images/realivent_button_banner.gif></a>-->
	  </div></td>
    <td width="850" valign="top" align="left" id=main_body> 
	<div style="margin-left:25px;">
	  <p>&nbsp;</p>
	  <p>&nbsp;</p>
	  <h1>Print Flyers and QR Codes</h1>
	  <p>Get your print flyer.</p>
	  <p>&nbsp;</p>
	  <h2>Step #1 Choose a listing from the pull-down menu below.</h2>
	  <p>&nbsp;</p>
	  <p><?php include('change_listing_include.php'); ?></p>
	  <div><br/>
       <p>Step #2 <?php if(isset($_REQUEST['listing_id'])) { ?><a href="../poster/account/download_pdf.php?listing_id=<?php echo $_REQUEST['listing_id'];?>">Download your PDF Flyer with QR Code</a><?php } else { ?>Download your PDF Flyer with QR Code<?php } ?></p>
      <br/>
      </div>
	  <div><br/>
       <p>Step #3 <strong>Get QR Code ONLY to </strong>print directly.<br/><br>
       <?php if(isset($_REQUEST['listing_id'])) { ?>
       <p>
       <table cellpadding="5" cellspacing="5" id="data_grid">
       	<tr>
       		<td>
       		<table cellpadding="5" cellspacing="5">
       			<tr>
		       		<td style="border:0px">URL</td>
		       		<td style="border:0px"><input type="text" name="qr_url" id="qr_url" value="http://<?php echo $_SERVER['HTTP_HOST']?>/vt/<?php echo $_REQUEST['listing_id'];?>"></td>
		       	</tr>
		       	<tr>
		       		<td style="border:0px">Select Size</td>
		       		<td style="border:0px">
		       			<select name="qr_size" id="qr_size">
		       				<option value="50x50">50x50</option>
		       				<option value="75x75">75x75</option>
		       				<option value="100x100">100x100</option>
		       				<option value="125x125">125x125</option>
		       				<option value="150x150">150x150</option>
		       				<option value="175x175">175x175</option>
		       				<option value="200x200">200x200</option>
		       				<option value="300x300">300x300</option>
		       				<option value="400x400">400x400</option>
		       				<option value="500x500">500x500</option>
		       				<option value="1000x1000">1000x1000</option>
		       			</select>
		       		</td>
		       	</tr>
		       	<tr>
		       		<td style="border:0px">
		       			<a href="javascript:;" onclick="previewQR('<?php echo $_REQUEST['listing_id'];?>')">Preview</a>
		       		</td>
		       		<td style="border:0px">
		       			<a href="javascript:;" onclick="downloadQR('<?php echo $_REQUEST['listing_id'];?>')">Download</a>
		       		</td>
		       	</tr>
		    </table>
       		</td>
       		<td align="center" id="preview_qr" width="210" height="210" bgcolor="#EEEEEE">
       			PREVIEW
       		</td>
       	</tr>
       	
       </table>
        
       </p>
       <?php } ?>
       </p>
      </div>
     
	</div>
	<BR>
	</td>
  </tr>
</table>
<?php include('../footer.php'); ?>
</body>
<script>
function previewQR(id) {
	qr_size = document.getElementById("qr_size").value;
	qr_url = document.getElementById("qr_url").value;
	document.getElementById("preview_qr").innerHTML = "<img src='https://chart.googleapis.com/chart?chs="+qr_size+"&cht=qr&chl="+qr_url+"'>";
}

function downloadQR(id) {
	qr_size = document.getElementById("qr_size").value;
	qr_url = document.getElementById("qr_url").value;
	window.location='../poster/account/download_qr.php?qr_size='+qr_size+'&qr_url='+encodeURIComponent(qr_url);
}
</script>
</html>